from flask import Blueprint
from flask import render_template
from flask import session
from flask import redirect
from Education.util.spiderRoom.finalScores import final_scores_spider

blue_index = Blueprint('index', __name__)


@blue_index.route('/index')
def goto_index():
    user = session.get('user')
    name = session.get('name')
    if not name:
        return redirect('/login')
    return render_template('index.html')


@blue_index.route('/schedule')
def goto_schedule():
    user = session.get('user')
    name = session.get('name')
    if not name:
        return redirect('/login')
    return render_template('schedule.html')


@blue_index.route('/scores')
def goto_scores():
    user = session.get('user')
    name = session.get('name')
    if not name:
        return redirect('/login')
    score = final_scores_spider(user, name)
    return render_template('scores.html', aaa=name)
